package com.itheima.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SetmealCheckgroupMapper {

    // 根据检查组id删除中间表数据（删除检查组）
    @Delete("delete from t_setmeal_checkgroup where checkgroup_id=#{id}")
    void deleteByCheckgroupId(Integer id);


    //void insertBySetmealIds(Integer id, List<Integer> checkGroupIds);

    // 添加套餐时, 向中间表 t_setmeal_checkgroup 添加数据
    @Insert("insert into t_setmeal_checkgroup(setmeal_id,checkgroup_id) " +
            "values(#{id},#{checkGroupIds})")
    void insertBySetmealIds(Integer setmealId,List<Integer> checkGroupIds);

    // 套餐管理 修改(根据套餐id删除中间表数据记录)
    @Delete("delete from t_setmeal_checkgroup where setmeal_id=#{id}")
    void deleteBySetmealIds(Integer id);
}
